function uploadFile() {
    var form = document.getElementById('upload');
    var userName = $('#user_name').text();
    formData = new FormData(form);
    formData.append("userName",userName);
    $.ajax({
        url:"midStudentImport",
        timeout : 10000,
        async: false,
        type:"post",
        data:formData,
        processData:false,
        contentType:false,
        success:function(res){
            if(res.successNum && res.repeatStudentId==null && res.failureStudentId ==null && res.repeatIDNumber==null){
                alert("成功导入：" + res.successNum + "条。")
            }else{
                alert("成功导入：" + res.successNum + "条。\n"
                    + "------------------------------\n"
                    + res.repeatStudentId + "考生号已存在。\n"
                    + "------------------------------\n"
                    + res.repeatIDNumber + "身份证号已存在。\n"
                    + "------------------------------\n"
                    + "考号为：" + res.failureStudentId + "未通过验证。\n请检查考生号或身份证号是否正确！"  );
            }
        },
        error:function(res){
            if(res){
                alert("上传失败，请检查！");
            }
        }
    });
}

function downloadTemplate(){
    $.post(ctx+"midDownloadTemplate",{},function(r){
        if (r.code == 0) {
            window.location.href = "common/download?fileName=" + r.msg + "&delete=" + true;
        } else {
            $MB.n_warning(r.msg);
        }
    });
}